package com.mini.repository;

import com.mini.model.BusinessRequirementPlanFormBean;
import com.mini.model.BusinessRequirementPlanNeedBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 项目名称：traditional-business
 * 类 名 称：businessRequirementPlanNeedRepository
 * 类 描 述：TODO
 * 创建时间：2021/1/20 下午3:43
 * 创 建 人：张慧颖
 */
public interface BusinessRequirementPlanNeedRepository extends JpaRepository<BusinessRequirementPlanNeedBean,Long>, JpaSpecificationExecutor<BusinessRequirementPlanNeedBean> {
    List<BusinessRequirementPlanNeedBean> findByTableIdAndNeedDelete(Long id,Integer delete);

    @Modifying
    @Query(value = "UPDATE business_requirement_plan_need SET need_delete=1\n" +
            "WHERE table_id in (?1) AND need_delete=0 ",nativeQuery = true)
    void updateByTableIds(List<Long> tableId);
}
